package com.pm.service.impl;

import com.pm.domain.PmProject;
import com.pm.domain.PmProjectAmenVO;
import com.pm.domain.Type;
import com.pm.mapper.PmProjectMapper;
import com.pm.service.IPmProjectService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务项目Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-24
 */
@Service
public class PmProjectServiceImpl implements IPmProjectService 
{
    @Autowired
    private PmProjectMapper pmProjectMapper;

    /**
     * 查询服务项目
     *
     * @param id 服务项目主键
     * @return 服务项目
     */
    @Override
    public PmProjectAmenVO selectPmProjectById(Long id)
    {
        PmProject pmProject = pmProjectMapper.selectPmProjectById(id);
        PmProjectAmenVO pmProjectAmenVO = new PmProjectAmenVO();
        BeanUtils.copyProperties(pmProject, pmProjectAmenVO);

        List<Type> types = pmProjectMapper.selectPmProjectType();
        pmProjectAmenVO.setTypeList(types);

        return pmProjectAmenVO;
    }

    /**
     * 查询服务项目列表
     * 
     * @param pmProject 服务项目
     * @return 服务项目
     */
    @Override
    public List<PmProject> selectPmProjectList(PmProject pmProject)
    {
        return pmProjectMapper.selectPmProjectList(pmProject);
    }

    /**
     * 新增服务项目
     * 
     * @param pmProject 服务项目
     * @return 结果
     */
    @Override
    public int insertPmProject(PmProject pmProject)
    {
        return pmProjectMapper.insertPmProject(pmProject);
    }

    /**
     * 修改服务项目
     * 
     * @param pmProject 服务项目
     * @return 结果
     */
    @Override
    public int updatePmProject(PmProject pmProject)
    {
        return pmProjectMapper.updatePmProject(pmProject);
    }

    /**
     * 批量删除服务项目
     * 
     * @param ids 需要删除的服务项目主键
     * @return 结果
     */
    @Override
    public int deletePmProjectByIds(Long[] ids)
    {
        return pmProjectMapper.deletePmProjectByIds(ids);
    }

    /**
     * 删除服务项目信息
     * 
     * @param id 服务项目主键
     * @return 结果
     */
    @Override
    public int deletePmProjectById(Long id)
    {
        return pmProjectMapper.deletePmProjectById(id);
    }

    @Override
    public Type selectPmProjectTyepName(Long id) {
        return pmProjectMapper.selectPmProjectTypeName(id);
    }
}
